﻿using DataShow.codeModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DataShow
{
    public partial class _5site : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txt_date.Text = DateTime.Now.ToString("yyyy-MM-dd");
                DateTime dt = DateTime.Now;
                int hour = dt.Hour;
                if (hour >= 0 && hour <= 8)
                {
                    rbl_sendpoint.Items[0].Selected = true;
                }
                else if (hour >= 9 && hour <= 13)
                {
                    rbl_sendpoint.Items[1].Selected = true;
                }
                else
                {
                    rbl_sendpoint.Items[2].Selected = true;
                }
            }
        }

        protected void btn_search_Click(object sender, EventArgs e)
        {
            string date = txt_date.Text.Trim();
            if (string.IsNullOrEmpty(date))
            {
                Common.RegisterScriptAtPageLast(Page, "alert('日期不能为空')");
            }
            string sendpoint = rbl_sendpoint.SelectedValue;
            string element = rbl_element.SelectedValue;
            und_lyg1.FillPanelData(DateTime.Parse(date), sendpoint, element);
            und_gy1.FillPanelData(DateTime.Parse(date), sendpoint, element);
            und_dh1.FillPanelData(DateTime.Parse(date), sendpoint, element);
            und_guanyun1.FillPanelData(DateTime.Parse(date), sendpoint, element);
            und_gn1.FillPanelData(DateTime.Parse(date), sendpoint, element);

            NUD1.FillPanelData(DateTime.Parse(date), sendpoint, element);
            NUD2.FillPanelData(DateTime.Parse(date), sendpoint, element);
            NUD3.FillPanelData(DateTime.Parse(date), sendpoint, element);
            NUD4.FillPanelData(DateTime.Parse(date), sendpoint, element);
            NUD5.FillPanelData(DateTime.Parse(date), sendpoint, element);
            NUD6.FillPanelData(DateTime.Parse(date), sendpoint, element);
            NUD7.FillPanelData(DateTime.Parse(date), sendpoint, element);
        }
    }
}